package Singleton;

import java.util.Locale;
import java.util.ResourceBundle;

public class Local {
	
	static Locale currentLocale;
	static ResourceBundle messages;
	
	public static String get(String string) {
		try {
		messages = ResourceBundle.getBundle("lang", getLocale());
		return messages.getString(string);
		}
		catch (java.util.MissingResourceException e) {
			return string;
		}
	}
	public static Locale getLocale() {
		if (currentLocale == null) {
			//Default language
	        currentLocale = new Locale("fr", "FR");
		}
		return currentLocale;
	}
	public static void setLocal(String a, String b) {
		currentLocale = new Locale(a, b);
		System.out.println("Changing the localisation to: "+a+"-"+b);
	}
}
